package com.atguigu09.inner;

public class OuterClass {
    public static void main(String[] args) {
        //创建静态内部类的实例 因为此类为静态，所以随着外部类的加载而加载，所以外部类不需要创建实例
        Person.Dog dog=new Person.Dog();
        dog.eat();
        //创建非静态内部类的实例
        Person p1=new Person();
        Person.Bird bird=p1.new Bird();
        bird.fly();
        bird.show("789");
    }
}


class Person{
    String name="tom";
    //静态内部类
    static class Dog{
        String name="tomdog";
        public void eat(){
            System.out.println("god eat");
        }
    }
    //非静态内部类
    class Bird{
        String name="tombird";
        public void fly(){
            System.out.println("bird fly");
        }
        public void show(String name){
            System.out.println(name);
            System.out.println(this.name);
          //  System.out.println(Dog.t.name);
            System.out.println(Person.this.name);

        }
    }

    public void method(){
        //局部内部类
        class  InnerClass{

        }
    }
}
